x86: Restore IA32_MISC_ENABLE on wakeup
authorMichał Kowalczyk <mkow@invisiblethingslab.com>
Mon, 23 Sep 2019 12:38:26 +0000 (14:38 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 23 Sep 2019 12:38:26 +0000 (14:38 +0200)
commit4e95d85b991f5d7e9a881e176395340a4441b44b
tree98db5262e38f9d48d21fa60832bb2cf4599cbcf4
parentda235ee4e738a1182f4360bcb38ee3bfefb553ef
x86: Restore IA32_MISC_ENABLE on wakeup

Code in intel.c:early_init_intel() modifies IA32_MISC_ENABLE MSR. Those
modifications must be restored after resuming from S3 (see e.g. Linux wakeup
code), otherwise bad things may happen (e.g. wakeup code may cause #GP when
trying to set IA32_EFER.NXE [1]).

This bug was noticed on a ThinkPad x230 with NX disabled in the BIOS:
Xen could correctly boot, but crashed when resuming from suspend.
Applying this patch fixed the problem.

[1] Intel SDM vol 3: "If the execute-disable capability is not
available, a write to set IA32_EFER.NXE produces a #GP exception."

Signed-off-by: Michał Kowalczyk <mkow@invisiblethingslab.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: c3cfa5b3084d71bccd8360d044bea813688b587c
master date: 2019-08-19 15:07:34 +0100
xen/arch/x86/boot/wakeup.S